<%-- 
    Document   : loanCollectionContent
    Created on : May 4, 2011, 2:12:01 AM
    Author     : MacBook
--%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<div id="dfc">
    <div id="div1"></div>
    <s:set name="viewdcf" value="viewdcf"/>
    <s:if test="%{#privilegeView.allowable == false}">
        <script type="text/javascript">window.location="home.jsp";</script>
    </s:if>
    <s:if test="%{#privilegeCreate.allowable == false}">
        <dl class="ui-state-highlight ui-corner-all" style="clear:both">
            <dt><span class="ui-icon ui-icon-info"></span>You are not allowed to create in this module.</dt>
        </dl>
        <script type="text/javascript">
            $(document).ready(function(){
                $('#viewdcf').attr("disabled","disabled");
                $('#printdfc').attr("disabled","disabled");
            });
        </script>
    </s:if>

    <s:form action="view-dcf" id="dfcinfo" cssStyle="overflow: auto; padding: 0;font-size: 12px;width:800px;" theme="simple">
        <s:if test="%{#viewdcf=='yes'}">
            <table>
                <tr>
                    <td><s:label>Branch Code</s:label></td>
                    <td><s:textfield label="Branch Code" type="text" id="branchid" name="branchid" cssClass="branchid" readonly="true" /></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td><s:label>Area Code</s:label></td>
                    <td><s:textfield id="acode" name="acode" value="%{#request.area.areacode}"/></td>
                    <td><s:label>AR Code</s:label></td>
                    <td><s:textfield id="ccode" name="ccode" cssClass="ccode" label="AR Code" value="%{#request.area.employees.employeeid}"/></td>
                    <td><s:label>AR Name</s:label></td>
                    <td><s:textfield id="cname" name="cname" label="AR Name" value="%{#request.area.collector}"/></td>
                </tr>
                <tr>
                    <td><s:label>Date</s:label></td>
                    <td><sj:textfield id="datedcf" name="datedcf" label="Date" value="%{#request.datedcf}"/></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
            </table>
        </s:if>
        <s:else>
            <table>
                <tr>
                    <td><s:label>Branch Code</s:label></td>
                    <td><s:textfield label="Branch Code" type="text" id="branchid" name="branchid" cssClass="branchid" readonly="true" /></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td><s:label>Area Code</s:label></td>
                    <td><s:action executeResult="false" name="get-areascoll" var="a"/>
                        <s:select label="Area Code"
                                  cssClass="acode"
                                  id="acode"
                                  name="acode"
                                  list="#a.areas"
                                  listKey ="areacode"
                                  listValue="areacode"
                                  headerKey="-1"
                                  cssStyle="width:150px;"
                                  headerValue="Select Area"
                                  value="selectvalue"/></td>
                    <td><s:label>AR Code</s:label></td>
                    <td><s:textfield id="ccode" name="ccode" cssClass="ccode" label="AR Code"/></td>
                    <td><s:label>AR Name</s:label></td>
                    <td><s:textfield id="cname" name="cname" label="AR Name"/></td>
                </tr>
                <tr>
                    <td><s:label>Date</s:label></td>
                    <td><sj:datepicker id="datedcf" name="datedcf" label="Date"/></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
            </table>
            <s:div style="float:right;margin-right:5em;">
                <sj:a button="true" cssClass="default" cssStyle="float:right;margin-top:2px;margin-left:3px">Print</sj:a>
                <sj:submit button="true" cssClass="default" id ="viewdcf" name="viewdcf" value="View" cssStyle="float:right"/>
            </s:div>
        </s:else>
    </s:form>

    <s:if test="%{#viewdcf=='yes'}">
        <div id="coll2" name="coll2" style="width:850px;clear:both;">
            <p>Daily Collection Form</p>

            <table border="1px" cellspacing="0" id="collectionform" style="width:500px;background-color: white;margin-bottom: 2em;font-size: 12px;margin-left:auto;margin-right: auto" >
                <thead>
                    <tr>
                        <th>Borrower Name</th>
                        <th>Days Left</th>
                        <th>Daily Amortization</th>
                        <th>Overdue</th>
                        <th>Balance</th>
                    </tr>
                </thead>
                <tbody id ="tbody">
                    <s:iterator value="#request.loanlist">
                        <tr>
                            <td><label><s:property value="completename"/></label></td>
                            <td><label><s:property value="daysleft"/></label></td>
                            <td><label><s:property value="amortizationperday"/></label> </td>
                            <td><label><s:property value="overdue"/></label> </td>
                            <td><label><s:property value="balance"/></label> </td>
                        </tr>
                    </s:iterator>
                </tbody>
            </table>
        </div>
        <s:div style="float:right;margin-right:5em;">
            <sj:a button="true" cssClass="default" id="printdfc" cssStyle="float:right;margin-top:2px;margin-right:17em;font-size:14px">Print</sj:a>
        </s:div>
    </s:if>

</div>
